<?php
/*******ajax函数*********/
function user_add_fav(){
	if( isset($_POST['action']) ){
		if( $_POST['action'] == 'add_to_fav' ){
			if(  is_user_logged_in() ){
				global $wpdb, $current_user;
				get_currentuserinfo();
				$uid = $current_user->ID;
				if(isset($_POST['fav'])){
					$post=$_POST['fav'];
					add_fav($post,$uid);
				}
			}else{
				echo '收藏请先登录';
			}
			die;
		}
	}
}
add_action("wp_ajax_add_to_fav", "user_add_fav");
?>